package org.example.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.example.entity.Psych;
import org.example.mapper.PsychMapper;
import org.example.service.PsychService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName PsychServiceImpl
 * @Description TODO
 * @Author lipeijin
 * @Date 2025年08月15日 下午6:27
 * @Version 1.0
 */
@Service
public class PsychServiceImpl implements PsychService {
    @Autowired
    private PsychMapper psychMapper;
    @Override
    public PageInfo<Psych> getPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Psych> psyches = psychMapper.getPage();
        PageInfo pageInfo = new PageInfo(psyches);
        return pageInfo;
    }

    @Override
    public PageInfo<Psych> getPageMore(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Psych> psyches = psychMapper.getPageMore();
        PageInfo pageInfo = new PageInfo(psyches);
        return pageInfo;
    }

    @Override
    public PageInfo<Psych> getPageByTime(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Psych> psyches = psychMapper.getPageByTime();
        PageInfo pageInfo = new PageInfo(psyches);
        return pageInfo;
    }

    @Override
    public PageInfo<Psych> getPageByNum(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Psych> psyches = psychMapper.getPageByNum();
        PageInfo pageInfo = new PageInfo(psyches);
        return pageInfo;
    }

    @Override
    public int addPsych(Psych psych) {
        return psychMapper.addPsych(psych);
    }

    @Override
    public int updateReplyCount(int id) {
        return psychMapper.updateReplyCount(id);
    }
}
